package cn.doitedu.datayi.loader;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.CellScanner;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.*;
import org.apache.hadoop.hbase.util.Bytes;

import java.io.IOException;

public class ProfileQueryTest {
    public static void main(String[] args) throws IOException {
        Configuration conf = HBaseConfiguration.create();
        Connection conn = ConnectionFactory.createConnection(conf);

        Table table = conn.getTable(TableName.valueOf("mall_user_profile"));

        Get get = new Get(Bytes.toBytes(2L));
        Result result = table.get(get);

        byte[] valueBytes = result.getValue("f".getBytes(), "tag0008".getBytes());
        int tag0008Value = Bytes.toInt(valueBytes);
        System.out.println(tag0008Value);

        table.close();
        conn.close();

    }
}
